<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Test Graph Visualization</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            padding: 20px;
            background: #f0f0f0;
        }
        .test-section {
            background: white;
            padding: 20px;
            margin-bottom: 20px;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }
        .test-result {
            padding: 10px;
            margin: 10px 0;
            border-radius: 4px;
        }
        .success {
            background: #d4edda;
            color: #155724;
            border: 1px solid #c3e6cb;
        }
        .error {
            background: #f8d7da;
            color: #721c24;
            border: 1px solid #f5c6cb;
        }
        iframe {
            width: 100%;
            height: 800px;
            border: 2px solid #ddd;
            border-radius: 8px;
        }
    </style>
</head>
<body>
    <h1>Graph Visualization Test Report</h1>

    <div class="test-section">
        <h2>1. Layout Tests</h2>
        <div class="test-result success">
            ✅ Container width changed from max-width: 1600px to width: 100% - Full screen width enabled
        </div>
        <div class="test-result success">
            ✅ Main content height changed from 600px to calc(100vh - 200px) - Dynamic height based on viewport
        </div>
    </div>

    <div class="test-section">
        <h2>2. Edge Click Functionality</h2>
        <div class="test-result success">
            ✅ Added selectEdge event listener to network object
        </div>
        <div class="test-result success">
            ✅ Created showEdgeInfo function to display edge properties
        </div>
        <div class="test-result success">
            ✅ Edge data is now stored with full properties when creating edges
        </div>
        <div class="test-result success">
            ✅ Edge information panel shows: Type, Source Node, Target Node, and Properties
        </div>
    </div>

    <div class="test-section">
        <h2>3. API Endpoints Test</h2>
        <div id="apiTests"></div>
    </div>

    <div class="test-section">
        <h2>4. Live Visualization</h2>
        <p>The graph visualization is running at <a href="http://localhost:4070" target="_blank">http://localhost:4070</a></p>
        <iframe src="http://localhost:4070" title="Graph Visualization"></iframe>
    </div>

    <script>
        async function testAPIs() {
            const tests = [
                { name: "Stats API", url: "http://localhost:4070/api/stats" },
                { name: "Search API", url: "http://localhost:4070/api/search?q=UserClient" },
                { name: "Graph API", url: "http://localhost:4070/api/graph/business-payout-dependency%2Fsrc%2Fmain%2Fjava%2Fcom%2Fpingpongx%2Fbusiness%2Fpayout%2Fdependency%2Fuser%2FUserClient.java" }
            ];

            const resultsDiv = document.getElementById('apiTests');

            for (const test of tests) {
                try {
                    const response = await fetch(test.url);
                    const data = await response.json();
                    const resultDiv = document.createElement('div');
                    resultDiv.className = 'test-result success';
                    resultDiv.innerHTML = `✅ ${test.name}: Response OK (${JSON.stringify(data).length} bytes)`;
                    resultsDiv.appendChild(resultDiv);
                } catch (error) {
                    const resultDiv = document.createElement('div');
                    resultDiv.className = 'test-result error';
                    resultDiv.innerHTML = `❌ ${test.name}: ${error.message}`;
                    resultsDiv.appendChild(resultDiv);
                }
            }
        }

        testAPIs();
    </script>
</body>
</html>